if not _timer then _timer=timer end

glookup = function(item)
	for k,v in pairs(_G) do
		if v==item then
			return k
		end
	end
	return nil
end

advtimer = function(time,rep,func,...)
	local rnd = math.random(1,5)..math.random(1,5)..math.random(1,5) --seq of 3 random numbers for temp name
	local f --function name
	if type(func)=="function" then
		if not glookup(func) then
			f = "temp_"..rnd --give the temp global function a name
			_G[f] = func --make a temporary global function
			_G[f.."_sd"] = function() --self-destruct function
				_G[f] = nil
				_G[f.."_sd"] = nil
			end
		else
			f = glookup(func)
		end
	else
		f = func --if func is just a string, set the name to that
	end
	_timer(time,f,unpack(arg),rep)
	if _G[f.."_sd"] then
		_timer(time*rep,f.."_sd") --if it exists, call the self-destruct function in the very end
	end
end